#include<iostream>
#include<cstdio>
using namespace std;
typedef long long LL;
LL n;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		scanf("%lld", &n);
		if (!n) {
			printf("0\n");
			continue;
		}
		if (n == 1) {
			printf("1\n");
			continue;
		}
		if (n % 2 == 0) {
			printf("2\n"); 
		}
		else {
			printf("3\n");
		}
	}
	return 0;
}